package com.groupbuying.store.service.impl;

import com.groupbuying.store.constants.CommonConstants;
import com.groupbuying.store.dao.CompanyQualificationDao;
import com.groupbuying.store.domain.CompanyQualificationDO;
import com.groupbuying.store.service.CompanyQualificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Service
public class CompanyQualificationServiceImpl implements CompanyQualificationService {
    @Autowired
    private CompanyQualificationDao companyQualificationDao;

    @Override
    public CompanyQualificationDO get(String uuid) {
        return companyQualificationDao.get(uuid);
    }

    @Override
    public List<CompanyQualificationDO> list(Map<String, Object> map) {
        return companyQualificationDao.list(map);
    }

    @Override
    public int count(Map<String, Object> map) {
        return companyQualificationDao.count(map);
    }

    @Override
    public int save(CompanyQualificationDO companyQualification) {
        return companyQualificationDao.save(companyQualification);
    }

    @Override
    public int update(CompanyQualificationDO companyQualification) {
        return companyQualificationDao.update(companyQualification);
    }

    @Override
    public int remove(String uuid) {
        return companyQualificationDao.remove(uuid);
    }

    @Override
    public int batchRemove(String[] uuids) {
        return companyQualificationDao.batchRemove(uuids);
    }

    @Override
    public CompanyQualificationDO getQualificationByCompanyUuid(String uuid) {

        Map<String, Object> params = new HashMap<>();
        params.put("delflag", CommonConstants.COMMON_FLAG_UNDEL);
        params.put("companyuuid", uuid);
        List<CompanyQualificationDO> list = companyQualificationDao.list(params);
        return list != null && list.size() > 0 ? list.get(0) : null;
    }


}
